// Tags:
#include <cstdio>
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("rgb.in", "r", stdin);
  freopen("rgb.out", "w", stdout);
#endif
#endif

  int r, g, b;
  scanf("#%2X%2X%2X", &r, &g, &b);
  r = 255 - r, g = 255 - g, b = 255 - b;
  printf("#%02X%02X%02X", r, g, b);
  return 0;
}